<template>
  <div class="totall">
    <div class="headerall">
      <div class="header">
        <div class="left">
          <ul>
            <li>
              <a href="#">
                红袖书网
                <span>|</span>
              </a>
            </li>
            <li>
              <a href="#">
                最近阅读
                <span>|</span>
              </a>
            </li>
            <li>
              <router-link to="/mybook">
                <a>我的书架</a>
              </router-link>
              <span>&nbsp;|</span>
            </li>
            <li>
              <a href="#">
                排行版
                <span>|</span>
              </a>
            </li>
            <li>
              <a href="#">APP下载</a>
            </li>
          </ul>
        </div>
        <div class="right">
          <ul>
            <li>
              <a href="#/login">注册</a>
            </li>
            <li>
              <a href="#/login">
                登陆&nbsp;&nbsp;
                <span>|</span>
              </a>
            </li>
          </ul>
        </div>
      </div>
    </div>
    <div class="search-zheng">
      <div class="search1">
        <img src="http://rcode.zongheng.com/v2018/images/logo.png" alt class="img1" />
        <div class="ww">
          <input type="text" placeholder="斗破" class="txt" ref="input" @keydown.enter="tap" />
          <el-button type="primary" @click="tap" class="btn2">
            <i class="el-icon-search"></i>
          </el-button>
        </div>
        <router-link to="/mybook">
          <div class="booklist">
            <i class="el-icon-notebook-2">&nbsp;我的书架</i>
          </div>
        </router-link>
      </div>
    </div>
  </div>
</template>
    
<script>
export default {
  data() {
    return {
      val: ""
    };
  },
  methods: {
    tap() {
      this.val = this.$refs.input.value;
      // console.log(this.val);
      let str = this.val;
      // let obj = {};
      // obj.query = this.val;
      let obj = this.val;
      // localStorage.setItem("obj", obj);

      // 通过query传参进行搜索

      // 通过query传参,str是一个字符串
      this.$router.push({ path: "/search", query: { id: str } });
      console.log(this.$route.query);
    }
  }
};
</script>
<style scoped>
a:hover {
  color: red;
}
.totall {
  height: 120px;
}
.headerall {
  width: 100%;
  background: rgb(247, 247, 247);
}
.header {
  height: 35px;
  font: 12px/35px PingFangSC-Regular, "-apple-system", Simsun;
  color: grey !important;
  background: rgb(247, 247, 247);
  width: 1200px;
  margin: 0 auto;
}

.left {
  float: left;
  width: 340px;

  height: 30px;
  /* margin-left: px; */
}
.left ul li {
  float: left;
  height: 35px;
  line-height: 35px;
}

.left ul {
  display: flex;

  justify-content: space-between;
}
.right {
  float: right;
  width: 50%;

  height: 30px;
}
.right ul li {
  float: right;
  height: 35px;

  line-height: 35px;
}
.right ul li:nth-child(1) {
  margin: 0px 0px 0 30px;
}

.center {
  background: #fff;
  height: 40px;
  width: 100%;
}
.center ul {
  float: right;
  height: 40px;
}
.center ul li {
  float: left;
  margin-right: 20px;
  text-align: center;
  color: #e29464;
}
.search-zheng {
  width: 1200px;
  background: white;
  margin: 0 auto;
}
.search1 {
  /* width: 800px; */
  margin-top: 10px;
  /* display: flex; */
  /* justify-content: space-between; */
  background: white;
}
.search1 .txt {
  height: 40px;
  /* border-radius: 20px 0 0 20px; */
  width: 330px;
}
.search1 .img1 {
  height: 35px;
  float: left;
  margin-top: 12px;
}
.btn2 {
  background: #bf2c24;
  width: 42px;
  height: 41px;
  border: 0;
  text-align: center;
  padding: 0;
  color: white !important;
  border-radius: 0;
  /* border: 1px solid #bf2c24; */
}
.btn2:hover {
  background-color: #ed4259;
}
.el-icon-search {
  color: white;
  font-weight: 600;
  /* font-size: 16px; */
}
/* .button2 {
  width: 80px;
  height: 40px;
  background: rgb(240, 24, 67);
  border-radius: 0 20px 20px 0;
  border: 1px solid #dbdbdb; 
} */

.ww {
  margin-top: 10px;
  margin-left: 210px;
  float: left;
}
.booklist {
  float: right;
  height: 40px;
  border: 1px solid #e6e6e6;
  font-size: 16px;
  display: block;
  width: 118px;
  text-align: center;
  line-height: 40px;
  margin-top: 10px;
  cursor: pointer;
}
.booklist:hover {
  color: #fff;
  border: 1px solid #ed4259;
  background: #ed4259;
}
</style>

